# Maintainer: Caleb Maclennan <caleb@alerque.com>

pkgname=perl-memory-usage
_pkgname=Memory-Usage
pkgver=0.201
pkgrel=2
pkgdesc='Perl/CPAN Module Memory::Usage tools to determine actual memory usage for Perl'
arch=(any)
license=(PerlArtistic GPL)
options=(!emptydirs)
depends=(perl)
makedepends=(perl-module-install)
url="https://metacpan.org/release/$_pkgname"
_archive="$_pkgname-$pkgver"
source=("http://search.cpan.org/CPAN/authors/id/D/DO/DONEILL/$_archive.tar.gz")
sha256sums=('8f2afad21e40a748e81c8c0f3e40ca718c14ddb9fb2d880bfbd28ae913ce5349')

build() {
	cd "$_archive"
	unset PERL5LIB PERL_MM_OPT PERL_LOCAL_LIB_ROOT
	export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps
	/usr/bin/perl Makefile.PL
	make
}

check() {
	cd "$_archive"
	unset PERL5LIB PERL_MM_OPT PERL_LOCAL_LIB_ROOT
	export PERL_MM_USE_DEFAULT=1
	make test
}

package() {
	cd "$_archive"
	unset PERL5LIB PERL_MM_OPT PERL_LOCAL_LIB_ROOT
	make install INSTALLDIRS=vendor DESTDIR="$pkgdir"
}
